/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package generated_entities;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.*;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author aav
 */
@Entity
@Table(name = "BRANCHES")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Branches.findAll", query = "SELECT b FROM Branches b"),
    @NamedQuery(name = "Branches.findByBrunchId", query = "SELECT b FROM Branches b WHERE b.brunchId = :brunchId"),
    @NamedQuery(name = "Branches.findByAddress", query = "SELECT b FROM Branches b WHERE b.address = :address"),
    @NamedQuery(name = "Branches.findByTelephones", query = "SELECT b FROM Branches b WHERE b.telephones = :telephones"),
    @NamedQuery(name = "Branches.findByCoordinates", query = "SELECT b FROM Branches b WHERE b.coordinates = :coordinates")})
public class Branches implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    //@Basic(optional = false)
    //@NotNull
    @Column(name = "BRUNCH_ID", nullable = false, precision = 0, scale = -127)
    private BigDecimal brunchId;
    @Size(max = 1024)
    @Column(name = "ADDRESS", length = 1024)
    private String address;
    @Size(max = 256)
    @Column(name = "TELEPHONES", length = 256)
    private String telephones;
    @Size(max = 64)
    @Column(name = "COORDINATES", length = 64)
    private String coordinates;
    @JoinColumn(name = "BANK_REGION_ID", referencedColumnName = "BANK_REGION_ID", nullable = false)
    @ManyToOne(optional = false)
    private BanksInRegions bankRegionId;

    public Branches() {
    }

    public Branches(BigDecimal brunchId) {
        this.brunchId = brunchId;
    }

    public BigDecimal getBrunchId() {
        return brunchId;
    }

    public void setBrunchId(BigDecimal brunchId) {
        this.brunchId = brunchId;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getTelephones() {
        return telephones;
    }

    public void setTelephones(String telephones) {
        this.telephones = telephones;
    }

    public String getCoordinates() {
        return coordinates;
    }

    public void setCoordinates(String coordinates) {
        this.coordinates = coordinates;
    }

    public BanksInRegions getBankRegionId() {
        return bankRegionId;
    }

    public void setBankRegionId(BanksInRegions bankRegionId) {
        this.bankRegionId = bankRegionId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (brunchId != null ? brunchId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Branches)) {
            return false;
        }
        Branches other = (Branches) object;
        if ((this.brunchId == null && other.brunchId != null) || (this.brunchId != null && !this.brunchId.equals(other.brunchId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return this.bankRegionId.toString() + address;
    }
    
}
